﻿using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace WebApiMIT3.Test
{
    // <Author>Rainer Schmitt</Author>
    // <StudentNo>1235656</StudentNo>
    // Copyright (c) 06/04/2015 All Right Reserved
    // <Date>06/04/2015</date>
    [TestClass]
    public class CompareUtil
    {
        [TestMethod]
        public void MoreThan5ProcentDifferent()
        {
            var oldText = "abcdefghijklmnop";
            var newText = "abcdefghijklmnopqrstvuxyz";
            bool actual = Utils.CompareUtil.IsMoreThan5ProcentDifferent(oldText, newText);

            Assert.IsTrue(actual);
        }

        [TestMethod]
        public void MoreThan5ProcentDifferent2()
        {
            var oldText = "mnop";
            var newText = "monp";
            bool actual = Utils.CompareUtil.IsMoreThan5ProcentDifferent(oldText, newText);

            Assert.IsTrue(actual);
        }

        [TestMethod]
        public void LessThan5ProcentDifferent()
        {
            var oldText = "abcdefghijklmnopqrstvuxy";
            var newText = "abcdefghijklmnopqrstvuxyz";
            bool actual = Utils.CompareUtil.IsMoreThan5ProcentDifferent(oldText, newText);

            Assert.IsFalse(actual);
        }

        [TestMethod]
        public void LessThan5ProcentDifferent2()
        {
            var oldText = "abcdefghijklmno";
            var newText = "abcdefghijklmno";
            bool actual = Utils.CompareUtil.IsMoreThan5ProcentDifferent(oldText, newText);

            Assert.IsFalse(actual);
        }
    }
}
